const path = require('path')
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const { DefinePlugin } = require('webpack')
const CopyWebpakcPlugin = require('copy-webpack-plugin')

module.exports = {
  mode: 'production',
  entry: "./src/index.js",
  devtool: 'source-map',
  output: {
    filename: 'js/bundle.js',
    // 必须是一个绝对路径
    path: path.resolve(__dirname, './build')
    // assetModuleFilename: 'img/[name][hash:6][ext]'
  },
  plugins: [
    new CleanWebpackPlugin(),
    new HtmlWebpackPlugin({
      title: '06_webpack模块化原理'
    })
  ]
}